var gulp = require('gulp'),
    jshint = require('gulp-jshint'),
    uglify = require('gulp-uglify'),
    rename = require('gulp-rename'),
    concat = require('gulp-concat'),
    connect = require('gulp-connect');
gulp.task('connect', function() {
    connect.server({
        livereload: true
    });
});

gulp.task('html', function() {
    gulp.src('index.html').pipe(connect.reload());
});

gulp.task('js', function() {
    gulp.src('zscroll.js').pipe(connect.reload());
});

gulp.task('watch', function() {
    gulp.watch('zscroll.js', ['js', 'scripts']);
});

gulp.task('scripts', function() {
    return gulp.src('zscroll.js')
        .pipe(rename({
            suffix: '.min'
        }))
        .pipe(uglify())
        .pipe(gulp.dest('dist/js/min'));
});

gulp.task('default', ['connect'], function() {
    gulp.start('watch');
});
